package behavioral_pattern.visitor_pattern;

public class HRDepartment extends Department{
    @Override
    public void visit(FulltimeEmployee fulltimeEmployee) {
        int workTime = fulltimeEmployee.getWorkTime();

        System.out.println("正式员工"+fulltimeEmployee.getName()+"实际工作时长为:"+workTime+"小时。");
        if (workTime>40){
            System.out.println("正式员工"+fulltimeEmployee.getName()+"实际工作时长为:"+(workTime-40)+"小时。");
        }else if (workTime<40){
            System.out.println("正式员工"+fulltimeEmployee.getName()+"请假时长为:"+(workTime-40)+"小时。");
        }
    }

    @Override
    public void visit(ParttimeEmployee parttimeEmployee) {
        int workTime = parttimeEmployee.getWorkTime();
        System.out.println("临时工"+parttimeEmployee.getName()+"实际工作时长为:"+workTime+"小时。");
    }
}
